﻿var BASE_URL = "http://" + window.location.host;
var UUM_URL = "http://" + window.location.hostname + ":7002";
//var OAUTH_URL = "http://172.16.14.168:8013";
var OAUTH_URL = "http://" + window.location.hostname + ":8013";
var BAOBIAO = "http://" + location.hostname + ":8075/ReportServer?reportlet=tzps_xmpsrckh.cpt&op=write"
var BAOBIAO_LOOK = "http://" + location.hostname + ":8075/ReportServer?reportlet=tzps_xmpsrckh.cpt"
var NIANDU_LOOK = "http://" + location.hostname + ":8075/ReportServer?reportlet=tzps_xmpsndkh.cpt"
var BAOBIAO_BASE = "http://" + location.hostname + ":8075";
var WEITUOSHU = "http://" + location.hostname + ":8075";

//var FEI_BAOBIAO = "http://"+location.hostname+":8083/ReportServer?reportlet=tzps_fsys.cpt&op=write"
var FEI_Y_BAOBIAO_LOOK = "http://" + location.hostname + ":8075/ReportServer?reportlet=tzps_fsys.cpt"
var FEI_J_BAOBIAO_LOOK = "http://" + location.hostname + ":8075/ReportServer?reportlet=tzps_fsjs.cpt"

var object = store.get("userInfo", true);
var ws = {
    util: {
        getQueryString: function (name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
            var r = window.location.search.substr(1).match(reg);
            if (r != null)
                return decodeURI(r[2]);
            return null;
        },
        getUserInfo: function () {
            if (object != null) {
                return object;
            }
        },
        loginout: function () {
            var url = "http://" + window.location.host + "/logout"
            return request.post(url);
        },
        oauthLogout: function () {
            var num = Math.ceil(Math.random() * 1000);
            var script = document.createElement('script');// 创建一个script标签元素。
            script.setAttribute('type', 'text/javascript');// 设置script标签的type属性。
            script.setAttribute('src', OAUTH_URL + "/images/logout/0231.js?"
                + num);
            if (navigator.userAgent.indexOf("IE") >= 0) {
                // IE下的事件
                script.onreadystatechange = function () {
                    if (script
                        && (script.readyState == "loaded" || script.readyState == "complete")) {
                        window.location.reload(true);

                    }
                }
            } else {
                script.onload = function () {
                    window.location.reload(true);

                }
            }
            document.body.appendChild(script);
        }
    },
    tzps: {
        getYearList: function (status, process) {
            var url = UUM_URL + "/uum/busyear/getList?status=" + status;
            var data = {};
            return request.get(url, data, process);
        },
        findRepList: function () {
            var url = BASE_URL + "/baseDataManagerServer/sysConfCollectionTemplate/findRepList";
            return request.get(url);
        }
    }
}
